package com.computer.demo.mvc.action;

import com.computer.demo.service.IQueryService;
import com.computer.spring.framework.annotation.BYAutowired;
import com.computer.spring.framework.annotation.BYController;
import com.computer.spring.framework.annotation.BYRequestMapping;
import com.computer.spring.framework.annotation.BYRequestParam;
import com.computer.spring.framework.webmvc.BYModelAndView;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description
 * @Author MagicIce
 * @Date 2020/11/23 9:11
 */
@BYController
@BYRequestMapping("/")
public class PageAction {

    @BYAutowired
    private IQueryService queryService;

    @BYRequestMapping("/first.html")
    public BYModelAndView query(@BYRequestParam("teacher") String teacher){
        String result = queryService.query(teacher);
        Map<String, Object> model = new HashMap<>();
        model.put("teacher", teacher);
        model.put("data", result);
        model.put("token", "123456");
        return new BYModelAndView("first.html", model);
    }

}
